package com.tptech.nearme.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;

/**
 * Entity implementation class for Entity: UserLocation
 * 
 */
@Entity
//@XmlSeeAlso(NearmeLocation.class)
public class UserLocation extends NearmeLocation implements Serializable {

	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="USER_LOCATION_ID_SEQ")
	@SequenceGenerator(allocationSize=1,initialValue=1,name="USER_LOCATION_ID_SEQ",sequenceName="USER_LOCATION_ID_SEQ")
	private Long id;

	@ManyToOne
	@JoinColumn(name="userid")
	private User user;

	@ManyToOne(optional=false,fetch=FetchType.EAGER)
	private Location location;
	
	private Double lat;

	private Double lon;

	private String description;
	private String address;

	private static final long serialVersionUID = 1L;

	public UserLocation() {
		super();
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}


	/* (non-Javadoc)
	 * @see com.tptech.nearme.model.NearmeLocation#getLat()
	 */
	@Override
	public Double getLat() {
		return lat;
	}

	public void setLat(Double lat) {
		this.lat = lat;
	}

	/* (non-Javadoc)
	 * @see com.tptech.nearme.model.NearmeLocation#getLon()
	 */
	@Override
	public Double getLon() {
		return lon;
	}

	public void setLon(Double lon) {
		this.lon = lon;
	}

	/* (non-Javadoc)
	 * @see com.tptech.nearme.model.NearmeLocation#getDescription()
	 */
	@Override
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	/* (non-Javadoc)
	 * @see com.tptech.nearme.model.NearmeLocation#getAddress()
	 */
	@Override
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

}
